#include<bits/stdc++.h>
using namespace std;
int a[105],b[1050];
int main()
{
    int n;
    int m;
    int cnt=0;
    cin >>m>>n;
    for (int i = 1; i <= n; i++)
        cin>>a[i];
    sort(a+1,a+n+1);
    for (int i = 1; i <= n; i++)
	{
        if(m>a[i])
        {
            m-=a[i];
            cnt++;
            b[a[i]]++;
        }
        else
        	break;
    }
    cout<<cnt<<endl;
    for (int i = 1; i <1000; i++) 
	{
		if(b[i]!=0)
       		printf("Killed %d energy value of %d\n",b[i],i);
    }
    return 0;
}
